package com.lsj.controller.type;

import com.google.gson.Gson;
import com.lsj.fileutil.FileUtil;
import com.lsj.fileutil.Type.TypeUtil;
import com.lsj.service.TypeService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

@RestController
@RequestMapping("/type")
public class TypeController {
    @Autowired
    private TypeService typeService;
    @Autowired
    TypeUtil typeUtil;
    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(TypeController.class);
    @RequestMapping("/getById")
    public List<String> testa(String id){
        List list = new ArrayList();
        list.add("payCode");
        list.add("channel");
        return list;
    }
    @RequestMapping("/getType")
    public List<Map<String, String>> getType(){
        List<Map<String,String>> list =new ArrayList<Map<String, String>>();
        try {
            list = typeUtil.getAll();
        } catch (Exception e) {
            LOGGER.info("读取测试类型错误，"+e.getMessage());
            e.printStackTrace();
        }
        return list;
    }
    @RequestMapping("/send")
    public void getType(String typeurl,String testtime,String sendList){
        Gson gs=new Gson();
        System.out.println(sendList);
        List<Map<String,Object>> list = gs.fromJson(sendList,List.class);
        System.out.println(list.toString());
    }
}
